<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>div移动</title>
    <style>
        .move {
            position: relative;
            width: 300px;
            height: 300px;
            border: 1px solid #000;
            top: 0;
            left: 0;
        }
    </style>
</head>

<body>
    <div class="move"></div>
    <script>
        var div = document.querySelector('.move')
        var n = 0;
        var id = setInterval(() => {
            if (n <= 200) {
                n = n + 1;
                div.style.left = n + 'px';

            } else {
                clearInterval(id);
            }
        }, 1000 / 60);
    </script>
</body>

</html>